package com.commerceerp.system.service.Impl;

import com.commerceerp.system.entity.PorderInfo;
import com.commerceerp.system.mapper.PorderMapper;
import com.commerceerp.system.service.PurchaseOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class PurchaseOrderServiceImpl implements PurchaseOrderService {

    @Autowired
    private PorderMapper porderMapper;


    /**
     * 获取建议中采购列表
     */
    @Override
    public List<Map> getAllPlanPurchase(String porderStorehouseId, String goodSystemSku, String goodSystemChname,String porderStatus,String porderId) {

        List<Map>  list = porderMapper.getAllPlanPurchase(porderStorehouseId,goodSystemSku,goodSystemChname,porderStatus,porderId);

        return list;
    }


    /**
     * 修改采购订单信息
     */
    @Override
    public Integer updPorderInfoById(PorderInfo porderInfo) {

        Integer success = porderMapper.updPorderInfoById(porderInfo);

        return success;
    }


    /**
     * 删除采购单信息
     */
    @Override
    public Integer delPorderInfoById(String porderId) {

        Integer success = porderMapper.delPorderInfoById(porderId);

        return success;
    }

    /**
     * 新增计划中采购单
     * @param porderInfo
     * @return
     */
    @Override
    public Integer saveNewPorderInfo(PorderInfo porderInfo) {

        Integer success = porderMapper.saveNewPorderInfo(porderInfo);

        return success;
    }

    @Override
    public Map<String,Object> getPorderInfoById(String porderId) {

        Map<String,Object> map = porderMapper.getPorderInfoById(porderId);

        return map;
    }


    /**
     * 采购页面的数量
     * @return
     */
    @Override
    public List<Map> getCountByPorderStatus() {

        List<Map> count = porderMapper.getCountByPorderStatus();

        return count;
    }


}
